package codigoBase;

import org.junit.Assert;

public class RecursiveSearch {
 
    public static int recursiveSearch(int[] sortedArray, int start, int end, int key) {
         
        if (start < end) {
            int mid = start + (end - start) / 2;  
            if (key < sortedArray[mid]) {
                return recursiveSearch(sortedArray, start, mid, key);
                 
            } else if (key > sortedArray[mid]) {
                return recursiveSearch(sortedArray, mid+1, end , key);
                 
            } else {
                return mid;   
            }
        }
        return -(start + 1);  
    }
    
public static void main(String[] args) {
	int[] sortedArray = {0};
	int start = 0;
	int end = 0;
	int key = 0;
	System.out.println(RecursiveSearch.recursiveSearch(sortedArray, start, end, key));
	}
}


